import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const files = require.context('@/views', true, /routes.js$/)
const generators = files.keys().map(key => files(key).default)
const routes = [];
generators.forEach(e => {
  routes.push(...e)
});

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
